<template>
  <el-dialog title="修改隧道信息" :visible.sync="dialogEditorVisible" width="43%" :before-close="handleClose">

    <el-form class="demo-form-inline" ref="form" :model="currentRow" label-width="100px">
      <el-row>
        <el-col :span="12"> <el-form-item label="隧道编码">
            <el-input v-model="currentRow.tunCode"></el-input>
          </el-form-item></el-col>
        <el-col :span="12"><el-form-item label="隧道类型">
            <el-input v-model="currentRow.tunType"></el-input>
          </el-form-item></el-col>
      </el-row>
      <el-row>
        <el-col :span="12"><el-form-item label="隧道名称">
            <el-input v-model="currentRow.tunName"></el-input>
          </el-form-item></el-col>
        <el-col :span="12">

          <el-form-item label="隧道长度">
            <el-input v-model="currentRow.tunLength"></el-input>
          </el-form-item></el-col>
      </el-row>
      <el-row>
        <el-col :span="12"><el-form-item label="起点桩号">
            <el-input v-model="currentRow.tunStartMileagePrefix"></el-input>
          </el-form-item></el-col>
        <el-col :span="12"><el-form-item label="结束桩号">
            <el-input v-model="currentRow.tunEndMileagePrefix"></el-input>
          </el-form-item></el-col>
      </el-row>
      <el-row>
        <el-col :span="12"><el-form-item label="建设单位">
            <el-input v-model="currentRow.tunDevelopunit"></el-input>
          </el-form-item></el-col>
        <el-col :span="12"><el-form-item label="施工单位">
            <el-input v-model="currentRow.tunConstructunit"></el-input>
          </el-form-item></el-col>
      </el-row>

      <el-row>
        <el-col :span="12">
          <el-form-item label="设计单位">
            <el-input v-model="currentRow.tunDesignunit"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12"> <el-form-item label="监理单位">
            <el-input v-model="currentRow.tunSupervisionunit"></el-input>
          </el-form-item></el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="创建时间">
            <el-date-picker type="date" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期"
              v-model="currentRow.createTime" style="width: 100%;"></el-date-picker>
          </el-form-item></el-col>
      </el-row>



    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogEditorVisible = false">取 消</el-button>
      <el-button type="primary" @click="create">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>

import api from "../../../api";
import qs from "qs"

export default {
  data() {
    return {
      dialogEditorVisible: false,
      tunnelList: [],
      fileList: [],
      currentRow: {}
    }
  },
  props: {
    flag: {
      type: Boolean,
      default: false,
    },
  },
  mounted() {
    this.$bus.$on("onShowEditor", (row) => {
      this.dialogEditorVisible = true;
      this.currentRow = row
    })
  },
  methods: {
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {

          done();
        }).catch(_ => { });
    },
    create() {
      api.tunnelInfoupdate(qs.stringify(this.currentRow)).then(res => {
        if (res.data.code == 2001) {
          this.$message({
            type: 'success',
            message: '更新成功!'
          });
          this.dialogEditorVisible = false
          this.$bus.$emit("onRefresh", true)
        } else {
          this.$message({
            type: 'fail',
            message: '更新失败!'
          });
          this.dialogVisible = false
          this.$bus.$emit("onRefresh", true)
        }

      }).catch(err => {
      })
    },
    onSubmit() {
      console.log('submit!');
    }
  }

}
</script>

<style scoped>
.avatar-uploader .el-upload {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: 1px dashed #d9d9d9;
  border-radius: 6PX;
}

.avatar-uploader .el-upload:hover {
  border-color: #409EFF;
}

.avatar-uploader-icon {
  width: 50PX !important;
  height: 50PX !important;
  font-size: 28PX;
  line-height: 50PX !important;
  color: #8c939d;
  text-align: center;
}

.avatar {
  display: block;
  width: 50PX !important;
  height: 50PX !important;
}

.imgbeforepad {
  padding-top: 0px !important;
}

.avatar-uploader .el-icon-plus {
  margin: 15PX !important;
}
</style>